package com.log.demo.code.utils;

import lombok.Data;

@Data
public class ResultMessage {
    private Integer state;//1表示成功，2表示失败
    private String message;
    private Object data;

    public ResultMessage() {
        this.state = 1;
    }

    public ResultMessage(String message) {
        this.state = 1;
        this.message = message;
    }

    public ResultMessage(Object data) {
        this.state = 1;
        this.data = data;
    }

    public ResultMessage(String message,Object data) {
        this.state = 1;
        this.message = message;
        this.data = data;
    }

    public ResultMessage(RuntimeException e) {
        this.state = 2;
        this.message = e.getMessage();
    }

    public ResultMessage(RuntimeException e,Object data) {
        this.state = 2;
        this.message = e.getMessage();
        this.data = data;
    }
}
